<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>不良品报检</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
	<style type="text/css">
		.layui-input {
			display: inline-block;
			width: 80%;
		}
	</style>
</head>
<body>
<!-- 疑似不良品信息 及操作 -->
<div id="details" style="margin:10px 0 0 15px;background-color:rgb(242,242,242);border-top:#e6e6e6 1px solid">
    <div>
    	<table class="layui-table">
    		<thead>
    			<tr>
    				<th colspan="2"><h2 style="text-align: center;">不良品报检单</h2></th>
    			</tr>
    		</thead>
    		<tbody>
    			<tr>
    				<td>配件批次号</td>
    				<td><input class="layui-input" type="text" id="iBatch"/></td>
    			</tr>
    			<tr>
    				<td>配件名称</td>
    				<td><input class="layui-input" type="text" id="iName"/></td>
    			</tr>
    			<tr>
    				<td>配件规格</td>
    				<td><input class="layui-input" type="text" id="iStandard"/></td>
    			</tr>
    			<tr>
    				<td>异常描述</td>
    				<td><textarea class="layui-textarea" style="width: 80%" id="iDescription"></textarea></td>
    			</tr>
    		</tbody>
    		<tfoot>
    			<tr>
    				<td colspan="3">
					  	<input class="layui-btn layui-btn-blue" type="button" style="padding: 0 30px" onclick = "save()" value="保存">
    				</td>
    			</tr>
    		</tfoot>
    	</table>
    </div>
</div>
<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
<script type="text/javascript">
		//保存报检单
		function save(){
			var iNumber = "BJ"+(new Date()).getTime();
			var iBatch = $("#iBatch").val();
			var iName = $("#iName").val();
			var iStandard = $("#iStandard").val();
			var iDescription = $("#iDescription").val();
			var iCode = ${iCode}; //条码获取
			var iPerson = ${iPerson}; //报检人获取
			var iStation = ${iStation}; //工位获取
			var iStatus = "0"; //订单状态
			$.ajax({
				type:'post'
				,url:'${pageContext.request.contextPath }/report/insertReport.do'
				,data:{iNumber:iNumber,iBatch:iBatch,iName:iName,iStandard:iStandard,iDescription:iDescription,iCode:iCode,iPerson:iPerson,iStation:iStation,iStatus:iStatus}
				,dataType:'json'
				,success:function(res){
					if(res>0){
						toastr.success("保存成功！");
						setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
							window.location.reload();  
						},2000);
					}else{
						toastr.error("保存失败！");
					}
				}
			})
		}
		toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
	</script>
</body>
</html>